package command;

/**
 * Factory for command interface. It checks message header
 * and according to info given they produce a new object 
 * that represents received request. This object implements
 * Command interface.
 * Available list of headers are:
 * registration
 * login
 * adminLogin
 * adminManageStatDat
 * adminCreateNewStations
 * adminRemoveStations
 * adminManageTrainDat
 * adminCreateNewTrains
 * adminRemoveTrains
 * adminManageScheduleDat
 * adminCreateSchedules
 * adminRemoveSchedules
 * clientManageStatDat
 * clientGetArrivalSchedule
 * clientGetDepartureSchedule
 * clientSearchTrains
 * clientBuyTicket
 * clienSellTicket
 * adminViewPassengersOnTrain
 * clienViewTicketInfo
 * adminManagePassengersDat
 * adminRemovePassengers
 * logout
 * adminModifyPassengers
 * adminDeletePassengerFromTrain
 * clientRefreshSelfInfo
 */
public class CommandFactory {
	public Command factory(String message) {
		if (message.equals("registration")) {
			return new ClientRegistration();
		}
		if (message.equals("login")) {
			return new ClientLogIn();
		}
		if (message.equals("adminLogin")) {
			return new AdminLogIn();
		}
		if (message.equals("adminManageStatDat")) {
			return new AdminManageStation();
		}
		if (message.equals("adminCreateNewStations")) {
			return new AdminCreateNewStation();
		}
		if (message.equals("adminRemoveStations")) {
			return new AdminRemoveStations();
		}
		if (message.equals("adminManageTrainDat")) {
			return new AdminManageTrain();
		}
		if (message.equals("adminCreateNewTrains")) {
			return new AdminCreateNewTrain();
		}
		if (message.equals("adminRemoveTrains")) {
			return new AdminRemoveTrains();
		}
		if (message.equals("adminManageScheduleDat")) {
			return new AdminManageSchedule();
		}
		if (message.equals("adminCreateSchedules")) {
			return new AdminCreateNewSchedule();
		}
		if (message.equals("adminRemoveSchedules")) {
			return new AdminRemoveSchedules();
		}
		if (message.equals("clientManageStatDat")) {
			return new ClientManageStation();
		}
		if (message.equals("clientGetArrivalSchedule")) {
			return new ClientGetArrivalSchedule();
		}
		if (message.equals("clientGetDepartureSchedule")) {
			return new ClientGetDepartureSchedule();
		}
		if (message.equals("clientSearchTrains")) {
			return new ClientSearchTrains();
		}
		if (message.equals("clientBuyTicket")) {
			return new ClientBuyTicket();
		}
		if (message.equals("clienSellTicket")) {
			return new ClientSellTicket();
		}
		if (message.equals("adminViewPassengersOnTrain")) {
			return new AdminViewPassengersOnTrain();
		}
		if (message.equals("clienViewTicketInfo")) {
			return new ClintViewTicketInfo();
		}
		if (message.equals("adminManagePassengersDat")) {
			return new AdminManagePassenger();
		}
		if (message.equals("adminRemovePassengers")) {
			return new AdminRemovePassengers();
		}
		if (message.equals("logout")) {
			return new ClientLogOut();
		}
		if (message.equals("adminModifyPassengers")) {
			return new AdminModifyPassengers();
		}
		if (message.equals("adminDeletePassengerFromTrain")) {
			return new AdminRemovePassengerFromTrain();
		}
		if (message.equals("clientRefreshSelfInfo")) {
			return new ClientRefreshSelfInfo();
		}
		return null;
	}
}
